package com.oxy.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.sf.json.JSONObject;

import com.oxy.common.constant.ActionConstant;
import com.oxy.action.util.ActionUtil;
import com.oxy.model.Pager;
import com.oxy.model.po.TestPO;
import com.oxy.svc.TestSvc;

public class TestAction extends BaseAction {
	public String index() {
		return ActionConstant.RESULT.SUCCESS;
	}
	
	public String i18n() {
		return ActionConstant.RESULT.SUCCESS;
	}
	
	public String i18nAjax() {
		String key = ActionUtil.getRequestParam("key");
		String value = null;
		if(key == null) {
			value = "no_key_found";
		}
		else {
			value = this.getText(key);
		}
		
		this.getParaOut().put("key", key);
		this.getParaOut().put("value", value);
		
		return ActionConstant.RESULT.SUCCESS;
	}

	public String list() {
		String ret = ActionConstant.RESULT.SUCCESS;
		TestSvc svc = (TestSvc)this.getSvcHolder().getSvcByIfClass(TestSvc.class);
		
		Pager pager = ActionUtil.preparePager(svc.getTestCount());
		this.getParaOut().put(ActionConstant.PARA_OUT.COMMON.PAGER, pager);
		
		List<TestPO> list = null;
		list = svc.list(pager);
		this.getParaOut().put(ActionConstant.PARA_OUT.TEST.TEST_LIST, list);
		return ret;
	}
}
